//
// Created on 2023/5/29.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".

#include "native_module_ohos_avcodec.h"
#include "avcodec_log.h"
#include "video_encoder_napi.h"

/*
 * Function registering all props and functions of ohos.media module
 * which involves player and the recorder
 */
static napi_value Export(napi_env env, napi_value exports)
{
    AVCODEC_LOGD("%s Export() is called",__FUNCTION__);
    OHOS::Media::VideoEncoderNapi::Init(env, exports);
    return exports;
}

/*
 * module define
 */
static napi_module g_module = {
    .nm_version = 1,
    .nm_flags = 0,
    .nm_filename = nullptr,
    .nm_register_func = Export,
    .nm_modname = "avcodec",
    .nm_priv = (reinterpret_cast<void*>(0)),
    .reserved = {0}
};

/*
 * module register
 */
extern "C" __attribute__((constructor)) void RegisterModule(void)
{
    AVCODEC_LOGD("RegisterModule() is called");
    napi_module_register(&g_module);
}
